package com.shenqi.parking.mapper;

import java.util.List;
import com.shenqi.parking.domain.ParkingSpots;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * 车位出租Mapper接口
 * 
 * @author shenqi
 * @date 2025-04-07
 */
public interface ParkingSpotsMapper 
{
    /**
     * 查询车位出租
     * 
     * @param id 车位出租主键
     * @return 车位出租
     */
    public ParkingSpots selectParkingSpotsById(Long id);

    /**
     * 查询车位出租列表
     * 
     * @param parkingSpots 车位出租
     * @return 车位出租集合
     */
    public List<ParkingSpots> selectParkingSpotsList(ParkingSpots parkingSpots);

    /**
     * 新增车位出租
     * 
     * @param parkingSpots 车位出租
     * @return 结果
     */
    public int insertParkingSpots(ParkingSpots parkingSpots);

    /**
     * 修改车位出租
     * 
     * @param parkingSpots 车位出租
     * @return 结果
     */
    public int updateParkingSpots(ParkingSpots parkingSpots);

    /**
     * 删除车位出租
     * 
     * @param id 车位出租主键
     * @return 结果
     */
    public int deleteParkingSpotsById(Long id);

    /**
     * 批量删除车位出租
     * 
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteParkingSpotsByIds(Long[] ids);

    @Select("SELECT COUNT(*) FROM parking_spots WHERE id = #{id} AND create_by = #{ownerUsername}")
    boolean existsByIdAndOwner(@Param("id") Long id, @Param("ownerUsername") String ownerUsername);
}
